<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">

  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    
    <!-- 操作按钮区域 -->
    <div class="table-operator">
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        class="j-table-force-nowrap"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: 'radio'}"
        @change="handleTableChange"

      >
      </a-table>
    </div>

  </a-card>
  </j-modal>

</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import '@/assets/less/TableExpand.less'

  export default {
    name: "BussMaterialProcurementList",
    mixins:[JeecgListMixin],
    components: {

    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
        description: '原料采购订单管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'编号',
            align:"center",
            dataIndex: 'code'
          },
          {
            title:'物料编号',
            align:"center",
            dataIndex: 'materialCode'
          },
          {
            title:'物料名称',
            align:"center",
            dataIndex: 'materialName'
          },
          {
            title:'规格',
            align:"center",
            dataIndex: 'spec'
          },
          {
            title:'订单数量',
            align:"center",
            dataIndex: 'procurementNum'
          },
          {
            title:'价格',
            align:"center",
            dataIndex: 'procurementArrayPrice'
          },
          {
            title:'制单人',
            align:"center",
            dataIndex: 'createBy'
          },
          {
            title:'制单日期',
            align:"center",
            dataIndex: 'createTime'
          },
          {
            title:'制单部门',
            align:"center",
            dataIndex: 'sysOrgCode'
          },
          {
            title:'供方单位',
            align:"center",
            dataIndex: 'supplierName'
          }
        ],
        url: {
          list: "/business/bussMaterialProcurement/list",
          delete: "/business/bussMaterialProcurement/delete",
          deleteBatch: "/business/bussMaterialProcurement/deleteBatch",
          exportXlsUrl: "/business/bussMaterialProcurement/exportXls",
          importExcelUrl: "/business/bussMaterialProcurement/importExcel",
          
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      }
    },
    methods: {
      add() {
        this.showModal();
      },
      showModal() {
        this.visible = true;
        this.loadData();
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          // this.$refs.realForm.edit(record);
        })
      },
      close() {
        // this.searchReset(false);
        this.queryParam = {}
        this.selectedRowKeys = []
        this.selectionRows = []
        this.visible = false;
      },
      handleOk () {
         this.$emit('handleOk',this.selectionRows[0]);
         this.close();
        // console.log(this.selectionRows[0])
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
         fieldList.push({type:'string',value:'code',text:'编号',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>